package com.tql.mall.model.cart;

import com.baomidou.mybatisplus.annotation.TableName;
import com.tql.mall.model.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

@Data
@NoArgsConstructor
@ApiModel(description = "购物车")
@TableName("cart_info")
public class CartInfo extends BaseEntity {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "用户id")
    private String userId;
    @ApiModelProperty(value = "skuId")
    private Long skuId;
    @ApiModelProperty(value = "shopId")
    private Long shopId;
    @ApiModelProperty(value = "实时价格")
    BigDecimal skuPrice;
    @ApiModelProperty(value = "放入购物车时价格")
    private BigDecimal cartPrice;
    @ApiModelProperty(value = "数量")
    private Integer skuNum;
    @ApiModelProperty(value = "封面")
    private String imgUrl;
    @ApiModelProperty(value = "sku名称 (冗余)")
    private String skuName;
    @ApiModelProperty(value = "isChecked")
    private Integer isChecked = 1;

    public CartInfo(String userId, Long skuId, Long shopId, BigDecimal skuPrice, BigDecimal cartPrice,
                    Integer skuNum, String skuName, String imgUrl,
                    Date createTime, Date updateTime
    ) {
        this.userId = userId;
        this.skuId = skuId;
        this.shopId = shopId;
        this.skuPrice = skuPrice;
        this.cartPrice = cartPrice;
        this.skuNum = skuNum;
        this.skuName = skuName;
        this.imgUrl = imgUrl;
        setCreateTime(createTime);
        setUpdateTime(updateTime);
    }
}
